package com.lcredu.aop.aspectj;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author 黎长容
 * @date 2025-07-15 15:38
 */
public class AspectjTest {
    
    @Test
    public void getSum(){
        ApplicationContext ioc = new ClassPathXmlApplicationContext("beans08.xml");
        //只能拿接口对象
        SmartAnimal bean = ioc.getBean(SmartAnimal.class);
        
        int sum = bean.getSum(1, 2);

        System.out.println("ok");
    }

    @Test
    public void getSum2(){
        ApplicationContext ioc = new ClassPathXmlApplicationContext("beans08.xml");
        //只能拿接口对象
        SmartAnimal bean = ioc.getBean(SmartAnimal.class);

        int sum = bean.getSum(10, 2);

        System.out.println("ok");
    }
}
